One function of a software interpreter is to translate instructions of an interpreted program into equivalent instructions that can be understood by an underlying platform running the software interpreter. As used herein, the term “underlying platform” includes the particular hardware and operating system combination of a computer system on which the software interpreter runs.
Sometimes, the interpreted program may include a native function declaration and a native function call instruction to call or invoke the native function. For purposes of this specification, the term “function” is to be interpreted broadly to include any software routine, e.g., a method, subroutine, procedure, etc. A native function is a function written or implemented in a language (“native language”) other than the language of the interpreted program. The interpreter calls or invokes the native function upon execution of the native function call instruction, and ensures that the correct parameters/arguments are available to underlying platform when the native function gets executed.
The native function code corresponding to each native function is normally resident in a library which may be a shared library or a dynamic link library (dll). In order to properly invoke native functions, the interpreter has a linking mechanism or interface which specifies a name, and a pointer value for each native function in the library.
The term “signature” of a native function denotes the parameters passed to the native function and the return value(s) of the native function.
In some cases, it is possible that a signature for a native function as declared in the interpreted program does not match the signature of the actual implementation of the native function in the library. If this happens, the interpreter will pass arguments for the native function based on the interpreted program declaration for the native function. These arguments will not match the arguments required by the actual implementation of native function and can lead to incorrect results or a system failure.